﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DMHangHoa : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboHangSanXuat")]
        private ComboBox _CboHangSanXuat;
        [AccessedThroughProperty("CboNganhHang")]
        private ComboBox _CboNganhHang;
        [AccessedThroughProperty("CboNhom")]
        private ComboBox _CboNhom;
        [AccessedThroughProperty("CboXuatXu")]
        private ComboBox _CboXuatXu;
        [AccessedThroughProperty("CmdAdd")]
        private ToolStripButton _CmdAdd;
        [AccessedThroughProperty("CmdDel")]
        private ToolStripButton _CmdDel;
        [AccessedThroughProperty("CmdEdit")]
        private ToolStripButton _CmdEdit;
        [AccessedThroughProperty("CmdExit")]
        private ToolStripButton _CmdExit;
        [AccessedThroughProperty("CmdHelp")]
        private ToolStripButton _CmdHelp;
        [AccessedThroughProperty("CmdPrint")]
        private ToolStripButton _CmdPrint;
        [AccessedThroughProperty("CmdRefresh")]
        private ToolStripButton _CmdRefresh;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label16")]
        private Label _Label16;
        [AccessedThroughProperty("Label17")]
        private Label _Label17;
        [AccessedThroughProperty("Label18")]
        private Label _Label18;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label25")]
        private Label _Label25;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("TextBox4")]
        private TextBox _TextBox4;
        [AccessedThroughProperty("TextBox5")]
        private TextBox _TextBox5;
        [AccessedThroughProperty("ToolStrip1")]
        private ToolStrip _ToolStrip1;
        [AccessedThroughProperty("ToolStripButton1")]
        private ToolStripSeparator _ToolStripButton1;
        [AccessedThroughProperty("ToolStripSeparator2")]
        private ToolStripSeparator _ToolStripSeparator2;
        [AccessedThroughProperty("ToolStripSeparator3")]
        private ToolStripSeparator _ToolStripSeparator3;
        [AccessedThroughProperty("TxtSearchCode")]
        private TextBox _TxtSearchCode;
        [AccessedThroughProperty("TxtSearchName")]
        private TextBox _TxtSearchName;
        [AccessedThroughProperty("VSList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSList;
        public bool bLoaded;
        private string cFrmKhoa;
        private string cFrmKhoaOld;
        private string cFrmTask;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private int mDelData;
        private int mEditData;
        private bool mEnableControl;
        private string mKhoaTKGiaVon;
        private string mKhoaTKHangHoa;
        private int mSend;
        private clsDMChiTietDonViTinh objDMCTDVT;
        private clsDMHangHoa objDMHangHoa;
        private DataView pData;
        public string Task;

        public Frm_DMHangHoa()
        {
            base.KeyDown += new KeyEventHandler(this.Frm_DMHangHoa_KeyDown);
            base.Load += new EventHandler(this.Frm_DMHangHoa_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.cFrmKhoaOld = "";
            this.cFrmKhoa = "";
            this.cFrmTask = "";
            this.objDMHangHoa = new clsDMHangHoa();
            this.objDMCTDVT = new clsDMChiTietDonViTinh();
            this.Task = "";
            this.mEditData = 1;
            this.mDelData = 1;
            this.bLoaded = false;
            this.InitializeComponent();
        }

        private void CboHangSanXuat_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CboNganhHang_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.bLoaded)
            {
                if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboNganhHang.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() != "")
                {
                    BuildComboModule.BuildCombo(this.CboNhom, modGeneral.ListDanhMuc.NhomHangHoa, true, Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(" KhoaNganh = '", this.CboNganhHang.SelectedValue), "'")), "");
                }
                else
                {
                    BuildComboModule.BuildCombo(this.CboNhom, modGeneral.ListDanhMuc.NhomHangHoa, true, "", "");
                }
                this.LoadData();
            }
        }

        private void CboNhom_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CboXuatXu_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CmdAdd_Click(object sender, EventArgs e)
        {
            MyProject.Forms.Frm_HangHoa.cFrmTask = "I";
            MyProject.Forms.Frm_HangHoa.ShowDialog();
            this.LoadData();
        }

        private void CmdDel_Click(object sender, EventArgs e)
        {
            if (!this.objDMHangHoa.WasUsed(this.cFrmKhoa))
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Dữ liệu đ\x00e3 được sử dụng, bạn kh\x00f4ng thể x\x00f3a!", ""));
            }
            else if (((this.VSList.Rows.Count != 1) && (this.VSList.Row > 0)) && (LVYModule.ConfirmDelete("") && this.objDMHangHoa.Delete(Conversions.ToString(this.VSList[this.VSList.Row, 0]))))
            {
                this.VSList.RemoveItem(this.VSList.Row);
            }
        }

        private void CmdEdit_Click(object sender, EventArgs e)
        {
            if ((this.VSList.Rows.Count != 1) && (this.VSList.Row > 0))
            {
                MyProject.Forms.Frm_HangHoa.cFrmKhoa = Conversions.ToString(this.VSList[this.VSList.Row, 0]);
                MyProject.Forms.Frm_HangHoa.cFrmTask = "U";
                MyProject.Forms.Frm_HangHoa.ShowDialog();
            }
        }

        private void CmdExit_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdHelp_Click(object sender, EventArgs e)
        {
            LVYModule.ShowHelp(@"DANHMUCDUNGCHUNG\DANHMUC\HANGHOANGUYENPHULIEU.mht");
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            MyProject.Forms.Frm_DKHangHoa.ShowDialog();
        }

        private void CmdRefresh_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_DMHangHoa_KeyDown(object sender, KeyEventArgs e)
        {
        }

        private void Frm_DMHangHoa_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.CmdDel.Enabled = this.mAllowDel;
                this.CmdEdit.Enabled = this.mAllowEdit;
                this.CmdAdd.Enabled = this.mAllowAdd;
                this.bLoaded = false;
                BuildComboModule.BuildCombo(this.CboNhom, modGeneral.ListDanhMuc.NhomHangHoa, true, "", "");
                BuildComboModule.BuildCombo(this.CboNganhHang, modGeneral.ListDanhMuc.NganhHang, true, "", "");
                BuildComboModule.BuildCombo(this.CboXuatXu, modGeneral.ListDanhMuc.QuocGia, true, "", "");
                BuildComboModule.BuildCombo(this.CboHangSanXuat, modGeneral.ListDanhMuc.HangSanXuat, true, "", "");
                this.bLoaded = true;
                this.LoadData();
                this.Cursor = Cursors.Default;
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DMHangHoa));
            this.ToolStripSeparator2 = new ToolStripSeparator();
            this.CmdEdit = new ToolStripButton();
            this.CmdAdd = new ToolStripButton();
            this.ToolStripSeparator3 = new ToolStripSeparator();
            this.CmdExit = new ToolStripButton();
            this.CmdPrint = new ToolStripButton();
            this.CmdDel = new ToolStripButton();
            this.ToolStripButton1 = new ToolStripSeparator();
            this.ToolStrip1 = new ToolStrip();
            this.CmdHelp = new ToolStripButton();
            this.CmdRefresh = new ToolStripButton();
            this.Label16 = new Label();
            this.Label17 = new Label();
            this.TextBox4 = new TextBox();
            this.TextBox5 = new TextBox();
            this.VSList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1 = new Panel();
            this.TxtSearchName = new TextBox();
            this.TxtSearchCode = new TextBox();
            this.Panel2 = new Panel();
            this.Label2 = new Label();
            this.CboXuatXu = new ComboBox();
            this.Label1 = new Label();
            this.CboNganhHang = new ComboBox();
            this.Label25 = new Label();
            this.CboHangSanXuat = new ComboBox();
            this.Label18 = new Label();
            this.CboNhom = new ComboBox();
            this.ToolStrip1.SuspendLayout();
            this.VSList.BeginInit();
            this.Panel1.SuspendLayout();
            this.Panel2.SuspendLayout();
            this.SuspendLayout();
            this.ToolStripSeparator2.Name = "ToolStripSeparator2";
            Size size = new Size(6, 0x19);
            this.ToolStripSeparator2.Size = size;
            this.CmdEdit.Image = (Image) manager.GetObject("CmdEdit.Image");
            this.CmdEdit.ImageTransparentColor = Color.White;
            this.CmdEdit.Name = "CmdEdit";
            size = new Size(0x2e, 0x16);
            this.CmdEdit.Size = size;
            this.CmdEdit.Text = "&Sửa";
            this.CmdAdd.Image = (Image) manager.GetObject("CmdAdd.Image");
            this.CmdAdd.ImageTransparentColor = Color.White;
            this.CmdAdd.Name = "CmdAdd";
            size = new Size(0x52, 0x16);
            this.CmdAdd.Size = size;
            this.CmdAdd.Text = "&Th\x00eam mới";
            this.ToolStripSeparator3.Name = "ToolStripSeparator3";
            size = new Size(6, 0x19);
            this.ToolStripSeparator3.Size = size;
            this.CmdExit.Alignment = ToolStripItemAlignment.Right;
            this.CmdExit.Image = (Image) manager.GetObject("CmdExit.Image");
            this.CmdExit.ImageTransparentColor = Color.White;
            this.CmdExit.Name = "CmdExit";
            size = new Size(0x3a, 0x16);
            this.CmdExit.Size = size;
            this.CmdExit.Text = "Th&o\x00e1t";
            this.CmdPrint.Image = (Image) manager.GetObject("CmdPrint.Image");
            this.CmdPrint.ImageTransparentColor = Color.White;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x25, 0x16);
            this.CmdPrint.Size = size;
            this.CmdPrint.Text = "&In";
            this.CmdDel.Image = (Image) manager.GetObject("CmdDel.Image");
            this.CmdDel.ImageTransparentColor = Color.White;
            this.CmdDel.Name = "CmdDel";
            size = new Size(0x2f, 0x16);
            this.CmdDel.Size = size;
            this.CmdDel.Text = "&X\x00f3a";
            this.ToolStripButton1.Name = "ToolStripButton1";
            size = new Size(6, 0x19);
            this.ToolStripButton1.Size = size;
            this.ToolStrip1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgbluenoborder;
            this.ToolStrip1.Items.AddRange(new ToolStripItem[] { this.CmdAdd, this.CmdEdit, this.ToolStripSeparator2, this.CmdPrint, this.ToolStripButton1, this.CmdDel, this.ToolStripSeparator3, this.CmdExit, this.CmdHelp, this.CmdRefresh });
            Point point = new Point(0, 0);
            this.ToolStrip1.Location = point;
            this.ToolStrip1.Name = "ToolStrip1";
            size = new Size(0x37e, 0x19);
            this.ToolStrip1.Size = size;
            this.ToolStrip1.TabIndex = 0x13;
            this.ToolStrip1.Text = "ToolStrip1";
            this.CmdHelp.Alignment = ToolStripItemAlignment.Right;
            this.CmdHelp.Image = (Image) manager.GetObject("CmdHelp.Image");
            this.CmdHelp.ImageTransparentColor = Color.White;
            this.CmdHelp.Name = "CmdHelp";
            size = new Size(0x48, 0x16);
            this.CmdHelp.Size = size;
            this.CmdHelp.Text = "Trợ gi\x00fap";
            this.CmdRefresh.Image = (Image) manager.GetObject("CmdRefresh.Image");
            this.CmdRefresh.ImageTransparentColor = Color.White;
            this.CmdRefresh.Name = "CmdRefresh";
            size = new Size(0x42, 0x16);
            this.CmdRefresh.Size = size;
            this.CmdRefresh.Text = "Refresh";
            this.Label16.AutoSize = true;
            point = new Point(0x58, 0x1a);
            this.Label16.Location = point;
            this.Label16.Name = "Label16";
            size = new Size(0x2a, 13);
            this.Label16.Size = size;
            this.Label16.TabIndex = 0x13;
            this.Label16.Text = "T\x00ecm t\x00ean";
            this.Label17.AutoSize = true;
            point = new Point(-1, 0x1a);
            this.Label17.Location = point;
            this.Label17.Name = "Label17";
            size = new Size(0x29, 13);
            this.Label17.Size = size;
            this.Label17.TabIndex = 0x12;
            this.Label17.Text = "T\x00ecm m\x00e3";
            point = new Point(90, 3);
            this.TextBox4.Location = point;
            this.TextBox4.Name = "TextBox4";
            size = new Size(0xc3, 20);
            this.TextBox4.Size = size;
            this.TextBox4.TabIndex = 1;
            point = new Point(0, 3);
            this.TextBox5.Location = point;
            this.TextBox5.Name = "TextBox5";
            size = new Size(90, 20);
            this.TextBox5.Size = size;
            this.TextBox5.TabIndex = 0;
            this.VSList.AllowEditing = false;
            this.VSList.AutoResize = false;
            this.VSList.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSList.ColumnInfo = manager.GetString("VSList.ColumnInfo");
            this.VSList.Dock = DockStyle.Fill;
            this.VSList.ExtendLastCol = true;
            this.VSList.FocusRect = FocusRectEnum.None;
            point = new Point(0, 70);
            this.VSList.Location = point;
            this.VSList.Name = "VSList";
            this.VSList.Rows.Count = 1;
            this.VSList.Rows.DefaultSize = 0x11;
            this.VSList.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x37e, 0x1d9);
            this.VSList.Size = size;
            this.VSList.StyleInfo = manager.GetString("VSList.StyleInfo");
            this.VSList.TabIndex = 20;
            this.VSList.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgbtleftblue;
            this.Panel1.Controls.Add(this.TxtSearchName);
            this.Panel1.Controls.Add(this.TxtSearchCode);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 0x21f);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x37e, 0x19);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x15;
            point = new Point(0x5e, 3);
            this.TxtSearchName.Location = point;
            this.TxtSearchName.Name = "TxtSearchName";
            size = new Size(0x103, 20);
            this.TxtSearchName.Size = size;
            this.TxtSearchName.TabIndex = 1;
            point = new Point(2, 3);
            this.TxtSearchCode.Location = point;
            this.TxtSearchCode.Name = "TxtSearchCode";
            size = new Size(90, 20);
            this.TxtSearchCode.Size = size;
            this.TxtSearchCode.TabIndex = 0;
            this.Panel2.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel2.Controls.Add(this.Label2);
            this.Panel2.Controls.Add(this.CboXuatXu);
            this.Panel2.Controls.Add(this.Label1);
            this.Panel2.Controls.Add(this.CboNganhHang);
            this.Panel2.Controls.Add(this.Label25);
            this.Panel2.Controls.Add(this.CboHangSanXuat);
            this.Panel2.Controls.Add(this.Label18);
            this.Panel2.Controls.Add(this.CboNhom);
            this.Panel2.Dock = DockStyle.Top;
            point = new Point(0, 0x19);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0x37e, 0x2d);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 0x16;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            this.Label2.ForeColor = Color.Black;
            point = new Point(0x199, 4);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x2b, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 40;
            this.Label2.Text = "Xuất xứ";
            this.CboXuatXu.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboXuatXu.FormattingEnabled = true;
            point = new Point(0x19b, 0x13);
            this.CboXuatXu.Location = point;
            this.CboXuatXu.Name = "CboXuatXu";
            size = new Size(0xba, 0x15);
            this.CboXuatXu.Size = size;
            this.CboXuatXu.TabIndex = 0x27;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            this.Label1.ForeColor = Color.Black;
            point = new Point(4, 4);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x42, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x26;
            this.Label1.Text = "Ng\x00e0nh h\x00e0ng";
            this.CboNganhHang.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboNganhHang.FormattingEnabled = true;
            point = new Point(7, 0x13);
            this.CboNganhHang.Location = point;
            this.CboNganhHang.Name = "CboNganhHang";
            size = new Size(0xcb, 0x15);
            this.CboNganhHang.Size = size;
            this.CboNganhHang.TabIndex = 0x25;
            this.Label25.AutoSize = true;
            this.Label25.BackColor = Color.Transparent;
            this.Label25.ForeColor = Color.Black;
            point = new Point(600, 4);
            this.Label25.Location = point;
            this.Label25.Name = "Label25";
            size = new Size(0x4c, 13);
            this.Label25.Size = size;
            this.Label25.TabIndex = 0x24;
            this.Label25.Text = "H\x00e3ng sản xuất";
            this.CboHangSanXuat.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboHangSanXuat.FormattingEnabled = true;
            point = new Point(0x25b, 0x13);
            this.CboHangSanXuat.Location = point;
            this.CboHangSanXuat.Name = "CboHangSanXuat";
            size = new Size(0xb8, 0x15);
            this.CboHangSanXuat.Size = size;
            this.CboHangSanXuat.TabIndex = 0x23;
            this.Label18.AutoSize = true;
            this.Label18.BackColor = Color.Transparent;
            this.Label18.ForeColor = Color.Black;
            point = new Point(0xd6, 4);
            this.Label18.Location = point;
            this.Label18.Name = "Label18";
            size = new Size(0x3e, 13);
            this.Label18.Size = size;
            this.Label18.TabIndex = 30;
            this.Label18.Text = "Nh\x00f3m h\x00e0ng";
            this.CboNhom.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboNhom.FormattingEnabled = true;
            point = new Point(0xd8, 0x13);
            this.CboNhom.Location = point;
            this.CboNhom.Name = "CboNhom";
            size = new Size(0xbd, 0x15);
            this.CboNhom.Size = size;
            this.CboNhom.TabIndex = 0x1d;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x37e, 0x238);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.VSList);
            this.Controls.Add(this.Panel1);
            this.Controls.Add(this.Panel2);
            this.Controls.Add(this.ToolStrip1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.Name = "Frm_DMHangHoa";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "DM-0003             ";
            this.Text = "DANH MUC HANG HOA";
            this.ToolStrip1.ResumeLayout(false);
            this.ToolStrip1.PerformLayout();
            this.VSList.EndInit();
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.Panel2.ResumeLayout(false);
            this.Panel2.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        public void LoadData()
        {
            if (this.bLoaded)
            {
                string pKhoaNhom = "";
                string strConditions = "";
                pKhoaNhom = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboNhom.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString();
                strConditions = " 1 = 1 ";
                if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboHangSanXuat.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() != "")
                {
                    strConditions = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(strConditions + " And HH.KhoaHangSanXuat = '", this.CboHangSanXuat.SelectedValue), "'"));
                }
                if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboXuatXu.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() != "")
                {
                    strConditions = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(strConditions + " AND HH.KhoaQuocGia = '", this.CboXuatXu.SelectedValue), "'"));
                }
                if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboNganhHang.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() != "")
                {
                    strConditions = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(strConditions + " AND HH.KhoaNganh = '", this.CboNganhHang.SelectedValue), "'"));
                }
                this.pData = new DataView(this.objDMHangHoa.ShowAllListHangHoa(pKhoaNhom, strConditions));
                this.VSList.DataSource = this.pData;
                C1.Win.C1FlexGrid.C1FlexGrid vSList = this.VSList;
                vSList.Cols[0].Visible = false;
                vSList.Cols[1].Width = 100;
                vSList.Cols[2].Width = 260;
                vSList.Cols[3].Width = 100;
                vSList.Cols[4].Width = 140;
                vSList.Cols[5].Width = 70;
                vSList.Cols[6].Width = 90;
                vSList[0, 1] = modGeneral.Tranlated("M\x00e3 h\x00e0ng h\x00f3a", "");
                vSList[0, 2] = modGeneral.Tranlated("T\x00ean h\x00e0ng h\x00f3a", "");
                vSList[0, 3] = modGeneral.Tranlated("M\x00e3 theo h\x00e3ng", "");
                vSList[0, 4] = modGeneral.Tranlated("Xuất xứ", "");
                vSList[0, 5] = modGeneral.Tranlated("ĐVT", "");
                vSList[0, 6] = modGeneral.Tranlated("Thuế suất", "");
                vSList[0, 7] = modGeneral.Tranlated("Gi\x00e1 b\x00e1n", "");
                vSList.Cols[7].DataType = System.Type.GetType("System.Decimal");
                vSList.Cols[7].Format = modGeneral.H_FORMATNUMBER;
                vSList = null;
                this.VSList.Styles.Alternate.BackColor = ProfessionalColors.ToolStripGradientMiddle;
            }
        }

        public void SearchHangHoa(string field, string str, string strPre = "")
        {
            string str2 = field + " LIKE '%" + strPre + str + "%'";
            this.pData.RowFilter = str2;
            C1.Win.C1FlexGrid.C1FlexGrid vSList = this.VSList;
            vSList.Cols[0].Visible = false;
            vSList.Cols[1].Width = 100;
            vSList.Cols[2].Width = 260;
            vSList.Cols[3].Width = 80;
            vSList.Cols[4].Width = 70;
            vSList.Cols[5].Width = 90;
            if (vSList.Rows.Count != 1)
            {
                vSList.Select(1, 0, 1, vSList.Cols.Count - 1);
            }
            vSList = null;
        }

        private void TxtSearchCode_TextChanged(object sender, EventArgs e)
        {
            this.SearchHangHoa("Ma", this.TxtSearchCode.Text, "");
        }

        private void TxtSearchName_TextChanged(object sender, EventArgs e)
        {
            this.SearchHangHoa("Ten", this.TxtSearchName.Text, "%");
        }

        private void VSList_DoubleClick(object sender, EventArgs e)
        {
            if ((this.VSList.Rows.Count != 1) && (this.VSList.Row > 0))
            {
                MyProject.Forms.Frm_HangHoa.cFrmKhoa = Conversions.ToString(this.VSList[this.VSList.Row, 0]);
                MyProject.Forms.Frm_HangHoa.ShowDialog();
            }
        }

        internal virtual ComboBox CboHangSanXuat
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboHangSanXuat;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboHangSanXuat_SelectedIndexChanged);
                if (this._CboHangSanXuat != null)
                {
                    this._CboHangSanXuat.SelectedIndexChanged -= handler;
                }
                this._CboHangSanXuat = value;
                if (this._CboHangSanXuat != null)
                {
                    this._CboHangSanXuat.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual ComboBox CboNganhHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboNganhHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboNganhHang_SelectedIndexChanged);
                if (this._CboNganhHang != null)
                {
                    this._CboNganhHang.SelectedIndexChanged -= handler;
                }
                this._CboNganhHang = value;
                if (this._CboNganhHang != null)
                {
                    this._CboNganhHang.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual ComboBox CboNhom
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboNhom;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboNhom_SelectedIndexChanged);
                if (this._CboNhom != null)
                {
                    this._CboNhom.SelectedIndexChanged -= handler;
                }
                this._CboNhom = value;
                if (this._CboNhom != null)
                {
                    this._CboNhom.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual ComboBox CboXuatXu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboXuatXu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboXuatXu_SelectedIndexChanged);
                if (this._CboXuatXu != null)
                {
                    this._CboXuatXu.SelectedIndexChanged -= handler;
                }
                this._CboXuatXu = value;
                if (this._CboXuatXu != null)
                {
                    this._CboXuatXu.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdAdd
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdAdd;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdAdd_Click);
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click -= handler;
                }
                this._CmdAdd = value;
                if (this._CmdAdd != null)
                {
                    this._CmdAdd.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdDel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDel_Click);
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click -= handler;
                }
                this._CmdDel = value;
                if (this._CmdDel != null)
                {
                    this._CmdDel.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdEdit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdEdit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdEdit_Click);
                if (this._CmdEdit != null)
                {
                    this._CmdEdit.Click -= handler;
                }
                this._CmdEdit = value;
                if (this._CmdEdit != null)
                {
                    this._CmdEdit.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdExit
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExit;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExit_Click);
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click -= handler;
                }
                this._CmdExit = value;
                if (this._CmdExit != null)
                {
                    this._CmdExit.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdHelp
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdHelp;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdHelp_Click);
                if (this._CmdHelp != null)
                {
                    this._CmdHelp.Click -= handler;
                }
                this._CmdHelp = value;
                if (this._CmdHelp != null)
                {
                    this._CmdHelp.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual ToolStripButton CmdRefresh
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdRefresh;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdRefresh_Click);
                if (this._CmdRefresh != null)
                {
                    this._CmdRefresh.Click -= handler;
                }
                this._CmdRefresh = value;
                if (this._CmdRefresh != null)
                {
                    this._CmdRefresh.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label16
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label16;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label16 = value;
            }
        }

        internal virtual Label Label17
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label17;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label17 = value;
            }
        }

        internal virtual Label Label18
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label18;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label18 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label25
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label25;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label25 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual TextBox TextBox4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TextBox4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TextBox4 = value;
            }
        }

        internal virtual TextBox TextBox5
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TextBox5;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TextBox5 = value;
            }
        }

        internal virtual ToolStrip ToolStrip1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStrip1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStrip1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripButton1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripButton1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripButton1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator2 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator3 = value;
            }
        }

        internal virtual TextBox TxtSearchCode
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSearchCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtSearchCode_TextChanged);
                if (this._TxtSearchCode != null)
                {
                    this._TxtSearchCode.TextChanged -= handler;
                }
                this._TxtSearchCode = value;
                if (this._TxtSearchCode != null)
                {
                    this._TxtSearchCode.TextChanged += handler;
                }
            }
        }

        internal virtual TextBox TxtSearchName
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSearchName;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtSearchName_TextChanged);
                if (this._TxtSearchName != null)
                {
                    this._TxtSearchName.TextChanged -= handler;
                }
                this._TxtSearchName = value;
                if (this._TxtSearchName != null)
                {
                    this._TxtSearchName.TextChanged += handler;
                }
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSList
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSList;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.VSList_DoubleClick);
                if (this._VSList != null)
                {
                    this._VSList.DoubleClick -= handler;
                }
                this._VSList = value;
                if (this._VSList != null)
                {
                    this._VSList.DoubleClick += handler;
                }
            }
        }
    }
}

